#!/usr/bin/env /usr/bin/python3

import os
import sys

dirname = os.path.dirname(os.path.abspath(__file__))
PAPARAZZI_HOME = os.getenv("PAPARAZZI_HOME",dirname)
PAPARAZZI_SRC = os.getenv("PAPARAZZI_SRC",PAPARAZZI_HOME)
env = os.environ
env['PAPARAZZI_HOME'] = PAPARAZZI_HOME
env['PAPARAZZI_SRC'] = PAPARAZZI_SRC

if len(sys.argv) > 1 and sys.argv[1] == "-legacy":
    del sys.argv[1]
    path = os.path.normpath(os.path.join(dirname, 'sw', 'supervision', 'paparazzicenter'))
    os.execve(path, sys.argv, env)
else:
    path = os.path.normpath(os.path.join(dirname, 'sw', 'supervision', 'python', 'paparazzicenter.py'))
    os.execve(path, sys.argv, env)

